#include <iostream>
#include <chrono>
using namespace std;
using namespace std::chrono;

class Timer{
public:
  Timer(){
    cout<<"Timer已创建，开始计时"<<endl;
    start = high_resolution_clock::now();
    end = high_resolution_clock::now();
  }
  ~Timer(){
      cout<<"Time已销毁，停止计时"<<endl;
      end = high_resolution_clock::now();
      auto duration = duration_cast<microseconds>(end - start);
      cout<<"共计:"<<duration.count()<<"毫秒."<<endl;
  }
private:
 time_point<high_resolution_clock> start;
 time_point<high_resolution_clock> end;
};